#include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
    long long maxEnergyBoost(vector<int>& energyDrinkA, vector<int>& energyDrinkB) {
        int n = energyDrinkA.size();
        vector<long long> A(n + 1, 0), B = A;
        for (int i = 0; i < n; ++i) {
            A[i + 1] = max(A[i] + energyDrinkA[i], B[i]);
            B[i + 1] = max(B[i] + energyDrinkB[i], A[i]);
        }
        return max(A.back(), B.back());
    }
};